﻿#pragma once

#include <QWidget>
#include "ui_RePackingMp4Window.h"
#include <thread>
#include <QString>
#include <QCloseEvent>

class RePackingMp4Window : public QWidget
{
	Q_OBJECT

public:
	RePackingMp4Window(QWidget *parent = nullptr);
	~RePackingMp4Window();

	void OnTransfer();
private:
	void PrintError(int err, QString msg);

protected:
	// 重写关闭事件处理函数
	void closeEvent(QCloseEvent* event) override;

public slots:
	void OnSrcFileSelected();
	void OnDstOutputFileSelected();
	void OnStartTransfer();
private:
	Ui::RePackingMp4Window ui;
	QString srcFilePath;
	QString dstFilePath;
	std::unique_ptr<std::thread> renderThread;
	bool isRunning = false;
	int outWidth = 400;
	int outHeight = 300;
	double begin_seconds = 0.0;//开始截取时间
	double end_seconds = 0.0;//结束截取时间
	long long begin_pts = 0;//开始pts
	long long begin_audio_pts = 0;//音频开始的pts
	long long end_pts = 0;//结束pts

};
